package com.woniuxy.controller;



import com.woniuxy.commons.utils.ResponseResult;

import com.woniuxy.dto.doctordto;
import com.woniuxy.service.IDoctorService;
import io.swagger.annotations.ApiOperation;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.lang.reflect.Field;

/**
 * <p>
 * 医生表 前端控制器
 * </p>
 *
 * @author litongmiao
 * @since 2022-06-08
 */
@RestController
@RequestMapping("/doctor")
public class DoctorController {
    @Resource
    IDoctorService iDoctorService;

    //1.查询全部医生表信息分页
    @ApiOperation(value = "分页查询所有医生")
    @GetMapping ("findAllByPage/{current}/{limit}")
    public ResponseResult findAllByPage(@PathVariable long current,@PathVariable long limit){
       return iDoctorService.findAllByPage(current,limit);
    }
    @GetMapping("findDoctorById/{id}")
    public ResponseResult findDoctorById(@PathVariable(value = "id") long id){
        return iDoctorService.findDoctorById(id);
    }

    //2.条件查询医生列表带分页查询
    @ApiOperation(value = "分页查询所有医生带条件查询")
    @GetMapping ("findDoctorByPage/{current}/{limit}/{active}")
    public ResponseResult findDoctorByPage(@PathVariable long current,
                                           @PathVariable long limit,
                                           @PathVariable int active,
                                           @RequestBody(required = false) doctordto doctordto
                                          ){
        return iDoctorService.findDoctorByPage(current,limit,active,doctordto);

    }

    @GetMapping("findDoctorByName/{name}")
    public ResponseResult findDoctorByName(@PathVariable(value = "name") String name){
        return iDoctorService.findDoctorByName(name);
    }

    @GetMapping("findDoctorSH/{current}/{limit}")
    public ResponseResult findDoctorSH(@PathVariable long current,
                                       @PathVariable long limit) {
        return iDoctorService.findDoctorSH(current, limit);

    }
    @GetMapping("findDoctorWSH/{current}/{limit}")
    public ResponseResult findDoctorWSH(@PathVariable long current,
                                       @PathVariable long limit) {
        return iDoctorService.findDoctorWSH(current, limit);

    }
    @DeleteMapping("deleteByDoctorId/{id}")
    public ResponseResult deleteDoctor(@PathVariable int id) {
        return iDoctorService.deleteDoctor(id);
    }
    @PutMapping("updateWUByid/{id}/{status}")
    public ResponseResult updateFWByid(@PathVariable int id,@PathVariable int status){
        return iDoctorService.updateFWByid(id,status);
    }

    @PutMapping("updateZGByid/{id}/{status}")
    public ResponseResult updateZGByid(@PathVariable int id,@PathVariable int status){
        return iDoctorService.updateZGByid(id,status);
    }



}
